package org.cangkuguanli.controller;

import jakarta.annotation.Resource;
import org.springframework.ai.chat.ChatClient;
import org.springframework.ai.chat.ChatResponse;
import org.springframework.ai.chat.messages.UserMessage;
import org.springframework.ai.chat.prompt.Prompt;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/deep")
public class DeepSeekController {
    @Resource
    private ChatClient chatClient;
    @RequestMapping("/ask")
    public String ask(@RequestParam("message") String message) {
        System.out.println(message);
        Prompt prompt = new Prompt(new UserMessage(message));
        ChatResponse response = chatClient.call(prompt);
        return response.getResult().getOutput().getContent();
    }
}
